﻿using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace netCoreStudy.Quartz
{
	public class ServerHostedService : IHostedService
	{
		private readonly ILogger<ServerHostedService> _logger;

		public ServerHostedService(
			ILogger<ServerHostedService> logger
		)

		{
			_logger = logger;
		}

		public async Task StartAsync(CancellationToken cancellationToken)
		{
			_logger.LogInformation("netCore启动啦");
		}

		public async Task StopAsync(CancellationToken cancellationToken)
		{
			await Task.Run(() => { _logger.LogInformation("程序正常退出"); }, cancellationToken);
		}
	}
}